{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "# 20春_Web数据挖掘-week01practive"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "source": [
    "### 抄用最人性化的模块\n",
    "* 来源 [最新的爬虫工具requests-html](https://www.cnblogs.com/fnng/p/8948015.html)\n",
    "* 文档 [requests-html](https://requests-html.kennethreitz.org/)\n",
    "\n",
    "####  项目0.A cnblogs 新闻"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "标题: 新西兰新增29例新冠肺炎病例 政府将进行强制隔离检疫\n",
      "链接: {'http://australia.people.com.cn/n1/2020/0409/c408038-31667856.html'}\n",
      "标题: 印尼单日新增新冠病例创新高 严禁公务人员开斋节返乡\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667833.html'}\n",
      "标题: 中国和柬埔寨举行双边自贸协定第二轮谈判\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667832.html'}\n",
      "标题: 马来西亚新增新冠肺炎确诊病例109例 累计4228例\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667829.html'}\n",
      "标题: 【网连世界】医护人员防护装备不足 在英华人积极协助抗“…\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667824.html'}\n",
      "标题: 歪果仁眼中的中国：东北日记·东北美食\n",
      "链接: {'http://australia.people.com.cn/n1/2020/0409/c408038-31667816.html'}\n",
      "标题: 中国驻奥克兰总领馆向留学生发放第一批防疫物资\n",
      "链接: {'http://australia.people.com.cn/n1/2020/0409/c408038-31667796.html'}\n",
      "标题: 新西兰新增病例连日下降 将强制隔离所有入境者\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667795.html'}\n",
      "标题: 中国赴刚果（金）维和医疗队全力做好应对疫情工作\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667737.html'}\n",
      "标题: 日本新冠确诊病例达4979例\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667730.html'}\n",
      "标题: 日本放宽限制实行在线初诊 费用与面对面诊疗相同\n",
      "链接: {'http://japan.people.com.cn/n1/2020/0409/c35421-31667727.html'}\n",
      "标题: 日本一公司董事因下属违反防疫隔离要求大打出手被警方逮捕\n",
      "链接: {'http://japan.people.com.cn/n1/2020/0409/c35421-31667726.html'}\n",
      "标题: 乌克兰新增确诊224例 总统总理曾接受新冠病毒检测\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667671.html'}\n",
      "标题: 委内瑞拉总统马杜罗会见中国抗疫医疗专家组\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667637.html'}\n",
      "标题: 积极沟通合作共享 中国助力全球战疫\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667636.html'}\n",
      "标题: 巴西中资企业和华侨华人向当地捐赠抗疫物资\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667631.html'}\n",
      "标题: 财经观察：油气行业困境或提高美国参与减产可能性\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667629.html'}\n",
      "标题: 揭开韩国高三学生“网上开学”首日 受访学生：“一个人上…\n",
      "链接: {'http://korea.people.com.cn/n1/2020/0409/c407864-31667598.html'}\n",
      "标题: 日本“紧急事态宣言”实施后 千叶县大部分保育园临时关闭\n",
      "链接: {'http://japan.people.com.cn/n1/2020/0409/c35421-31667580.html'}\n",
      "标题: 非洲新冠确诊病例达10789例 经济增速预计将放缓\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667573.html'}\n",
      "标题: 乌兹别克斯坦多所专科医院和隔离区加速建设\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667572.html'}\n",
      "标题: 德国五大研究所预测德国经济今年萎缩4.2%\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667570.html'}\n",
      "标题: 【红十字国际委员会主席署名文章】勠力同心 应对新冠肺炎…\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667568.html'}\n",
      "标题: 韩国新增39例新冠确诊病例 累计10423例\n",
      "链接: {'http://korea.people.com.cn/n1/2020/0409/c407864-31667566.html'}\n",
      "标题: 国际观察：疫情将改变世界，基辛格看到了什么？\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667560.html'}\n",
      "标题: 日本爱知县将于10日发布“紧急状态宣言”\n",
      "链接: {'http://japan.people.com.cn/n1/2020/0409/c35421-31667559.html'}\n",
      "标题: 受疫情影响 日本青森“睡魔祭”今夏停办\n",
      "链接: {'http://japan.people.com.cn/n1/2020/0409/c35421-31667558.html'}\n",
      "标题: 泰国新增54例新冠肺炎确诊病例 累计确诊2423例\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667544.html'}\n",
      "标题: 吉尔吉斯斯坦新增10例新冠肺炎确诊病例 累计确诊数达到…\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667532.html'}\n",
      "标题: 新加坡单日新增病例创新高 印度多地延长“封城”\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667531.html'}\n",
      "标题: 哈萨克斯坦新冠肺炎确诊病例达到759例 死亡7例\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667530.html'}\n",
      "标题: 东京600名出租车司机被解雇 低薪冒风险出车不如领失业…\n",
      "链接: {'http://japan.people.com.cn/n1/2020/0409/c35421-31667529.html'}\n",
      "标题: 中国驻美使领馆加强疫情协助热线接听\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667527.html'}\n",
      "标题: 美最新研究：纽约新冠疫情主要始于欧洲输入\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667524.html'}\n",
      "标题: 荷比卢新冠病例持续增加 荷兰确诊病例超2万\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667523.html'}\n",
      "标题: 综述：阿根廷防疫措施严格 民众支持声中有担忧\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667522.html'}\n",
      "标题: 疫情冲击政治经济 拉美国家全力应对\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667521.html'}\n",
      "标题: 新闻分析：新冠病毒抗体检测为何越来越重要\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667520.html'}\n",
      "标题: 罗马尼亚首次出现新冠病例治愈后“复阳”现象\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667519.html'}\n",
      "标题: 世贸组织总干事：新冠疫情不必然导致逆全球化\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667518.html'}\n",
      "标题: 联合国欢迎多国联军宣布在也门单方面停火\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667517.html'}\n",
      "标题: 美国餐饮业“花式自救”难抵疫情冲击\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667515.html'}\n",
      "标题: 美联储：新冠疫情令美国经济前景急剧恶化\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667510.html'}\n",
      "标题: 调查：日本大学生最信赖的媒体是报纸 电视不如网络\n",
      "链接: {'http://japan.people.com.cn/n1/2020/0409/c35421-31667438.html'}\n",
      "标题: 日本拘留所发现首例新冠肺炎确诊病例\n",
      "链接: {'http://japan.people.com.cn/n1/2020/0409/c35421-31667434.html'}\n",
      "标题: 年度最大满月 多国再现超级月亮\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667414.html'}\n",
      "标题: 英国累计新冠死亡病例数超7000 首相情况稳定\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667375.html'}\n",
      "标题: 世卫组织总干事：勿将新冠病毒当作政治筹码\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667374.html'}\n",
      "标题: 一批丹麦从中国采购防疫物资抵达丹麦\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667371.html'}\n",
      "标题: 英雄的城市为世界作出重要贡献（和音）\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31667335.html'}\n",
      "标题: 印个别组织要求中国\"赔偿疫情损失\"…\n",
      "链接: {'http://world.people.com.cn/n1/2020/0408/c1002-31666235.html'}\n",
      "标题: 中国驻美大使崔天凯在《纽约时报》刊…\n",
      "链接: {'http://world.people.com.cn/n1/2020/0406/c1002-31662844.html'}\n",
      "标题: 中国从不会在朋友有难时袖手旁观，抗…\n",
      "链接: {'http://world.people.com.cn/n1/2020/0404/c1002-31661897.html'}\n",
      "标题: 王毅分别同葡萄牙、卢森堡外长通电话\n",
      "链接: {'http://world.people.com.cn/n1/2020/0331/c1002-31655908.html'}\n",
      "标题: 王毅：坚持多边主义，团结一致共抗疫情\n",
      "链接: {'http://world.people.com.cn/n1/2020/0331/c1002-31655907.html'}\n",
      "标题: 中国大使发文痛斥美国记者所谓新冠疫…\n",
      "链接: {'http://world.people.com.cn/n1/2020/0331/c1002-31655616.html'}\n",
      "标题: 网连世界：每周五聆听海外之声\n",
      "链接: {'http://world.people.com.cn/GB/8212/191615/422144/index.html'}\n",
      "标题: 外交部发言人一周观点撷英\n",
      "链接: {'http://world.people.com.cn/GB/8212/191615/428295/index.html'}\n",
      "标题: 新中国成立70年·大使说\n",
      "链接: {'http://world.people.com.cn/GB/8212/191816/427123/index.html'}\n",
      "标题: 第二届“一带一路”国际合作高峰论坛\n",
      "链接: {'http://world.people.com.cn/GB/8212/191816/426372/index.html'}\n",
      "标题: 中国排外情绪上升？外交部：反对一切…\n",
      "链接: {'http://world.people.com.cn/n1/2020/0407/c1002-31664658.html'}\n",
      "标题: 英国首相约翰逊被转入重症监护室\n",
      "链接: {'http://world.people.com.cn/n1/2020/0407/c1002-31663106.html'}\n",
      "标题: 金灿荣：抗疫大考揭示国际政治现实\n",
      "链接: {'http://world.people.com.cn/n1/2020/0407/c1002-31663434.html'}\n",
      "标题: 纽约时报：官方统计低估美国新冠肺炎…\n",
      "链接: {'http://world.people.com.cn/n1/2020/0406/c1002-31662707.html'}\n",
      "标题: 我驻法国使馆批驳西方“甩锅”中国 …\n",
      "链接: {'http://world.people.com.cn/n1/2020/0406/c1002-31662716.html'}\n",
      "标题: 约翰斯·霍普金斯大学：全球新冠死亡…\n",
      "链接: {'http://world.people.com.cn/n1/2020/0406/c1002-31662956.html'}\n",
      "标题: 日本定于今日宣布紧急状态\n",
      "链接: {'http://world.people.com.cn/n1/2020/0407/c1002-31663184.html'}\n",
      "标题: 约翰斯·霍普金斯大学：全球确诊病例…\n",
      "链接: {'http://world.people.com.cn/n1/2020/0409/c1002-31666481.html'}\n",
      "标题: 中国驻美大使崔天凯在《纽约时报》刊…\n",
      "链接: {'http://world.people.com.cn/n1/2020/0406/c1002-31662844.html'}\n",
      "标题: 中国驻法国大使馆就在法侨团负责人和…\n",
      "链接: {'http://world.people.com.cn/n1/2020/0408/c1002-31664924.html'}\n",
      "标题: 温宪\n",
      "链接: set()\n",
      "标题: 丁刚\n",
      "链接: {'http://www.people.com.cn/GB/8722/11164/368360/index.html'}\n",
      "标题: 吕鸿\n",
      "链接: {'http://world.people.com.cn/GB/8212/29138/index.html'}\n",
      "标题: 老任\n",
      "链接: {'http://world.people.com.cn/GB/8212/191615/97684/97686/37402/37519/index.html'}\n",
      "标题: 安国章\n",
      "链接: {'http://world.people.com.cn/GB/8212/59887/index.html'}\n",
      "标题: 高轶军\n",
      "链接: {'http://world.people.com.cn/GB/guoji/209/7704/index.html'}\n",
      "标题: 王晓鹏\n",
      "链接: {'http://world.people.com.cn/GB/8212/191615/347084/index.html'}\n",
      "标题: 张旭东\n",
      "链接: {'http://world.people.com.cn/GB/8212/191615/350646/index.html'}\n",
      "标题: 任亚秋\n",
      "链接: {'http://world.people.com.cn/GB/8212/191615/239730/index.html'}\n",
      "标题: 李航\n",
      "链接: {'http://world.people.com.cn/GB/8212/191615/385976/index.html'}\n",
      "标题: 谢荣镇\n",
      "链接: {'http://world.people.com.cn/GB/8212/97684/97686/123748/index.html'}\n",
      "标题: 任景国\n",
      "链接: {'http://world.people.com.cn/GB/8212/191615/97684/97686/226128/index.html'}\n",
      "标题: 冯霄\n",
      "链接: {'http://world.people.com.cn/GB/8212/191615/97684/97686/220210/220211/index.html'}\n",
      "标题: 于世文\n",
      "链接: {'http://world.people.com.cn/GB/8212/191615/97684/97686/220210/220211/index.html'}\n",
      "标题: 王文\n",
      "链接: {'http://world.people.com.cn/GB/97684/97686/403521/index.html'}\n",
      "标题: 王璐\n",
      "链接: {'http://world.people.com.cn/GB/97684/97686/384762/index.html'}\n",
      "标题: 常红\n",
      "链接: {'http://world.people.com.cn/GB/168909/121798/index.html'}\n",
      "标题: 杨牧\n",
      "链接: {'http://world.people.com.cn/GB/8212/97684/168909/168912/index.html'}\n",
      "标题: 燕勐\n",
      "链接: {'http://world.people.com.cn/GB/168909/409800/index.html'}\n",
      "标题: 崔越\n",
      "链接: {'http://world.people.com.cn/GB/168909/429747/index.html'}\n",
      "标题: 刘洁妍\n",
      "链接: {'http://world.people.com.cn/GB/8212/191615/97684/168909/364276/index.html'}\n",
      "标题: 贾文婷\n",
      "链接: {'http://world.people.com.cn/GB/168909/348232/index.html'}\n",
      "标题: 徐祥丽\n",
      "链接: {'http://world.people.com.cn/GB/168909/409798/index.html'}\n",
      "标题: 刘叶婷\n",
      "链接: {'http://world.people.com.cn/GB/168909/429748/index.html'}\n"
     ]
    }
   ],
   "source": [
    "# 00: 使用 \n",
    "from requests_html import HTMLSession\n",
    "\n",
    "# 01: 使用session 猜是給定url ()\n",
    "session = HTMLSession()\n",
    "r = session.get(\"http://world.people.com.cn/GB/157278/index.html\") #人民网-国际-滚动新闻\n",
    "\n",
    "# 02: 使用.find ???? (CSS selector; r.html.find)\n",
    "# 通过CSS找到新闻标签\n",
    "news = r.html.find('li > a')  \n",
    "# 03: 结果輸出\n",
    "for new in news:\n",
    "    print(\"标题:\", new.text)  # 获得新闻标题\n",
    "    print(\"链接:\", new.absolute_links)  # 获得新闻链接"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "### 不是算Python的内容：HTML 之 xpath 与 selector\n",
    "\n",
    "接下来需要选择器selector抽取数据img，借用HTML的\"结构\"性(chrome要从页面选到结构，你懂的)，有两种可能，必记下来\n",
    "* xpath \n",
    "* CSS selector\n",
    "\n",
    "试第一个和另一个，看看有什麽规律 (侦探活)\n",
    "Chrome Console下使用Javascript\n",
    "* xpath: \n",
    "```$x(\"放这\")```\n",
    "\n",
    "* CSS: \n",
    "``` $(\"放这\") ```\n",
    "\n",
    "-----\n",
    "\n",
    "####  项目0.B liepin 工作"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "招聘职位 高级Python工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927302557.shtml'}\n",
      "招聘职位 python开发工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927135335.shtml'}\n",
      "招聘职位 python开发工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1926012273.shtml'}\n",
      "招聘职位 python开发工程师 (MJ000319)\n",
      "职位招聘链接 {'https://www.liepin.com/job/1924707593.shtml'}\n",
      "招聘职位 Python开发工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927332937.shtml'}\n",
      "招聘职位 Python开发工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927332705.shtml'}\n",
      "招聘职位 Python开发工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927329987.shtml'}\n",
      "招聘职位 Python开发工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927326671.shtml'}\n",
      "招聘职位 Python测试开发工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927326373.shtml'}\n",
      "招聘职位 Python开发工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927325825.shtml'}\n",
      "招聘职位 Python开发工程师（Python Engineer）\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927325167.shtml'}\n",
      "招聘职位 python开发工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927323829.shtml'}\n",
      "招聘职位 Python开发工程师（远光研究院）\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927317835.shtml'}\n",
      "招聘职位 Python开发\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927316091.shtml'}\n",
      "招聘职位 Python开发\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927316089.shtml'}\n",
      "招聘职位 数据开发工程师（python）\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927313055.shtml'}\n",
      "招聘职位 python开发\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927309869.shtml'}\n",
      "招聘职位 python讲师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927307923.shtml'}\n",
      "招聘职位 Python爬虫工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927307495.shtml'}\n",
      "招聘职位 Python开发工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927307429.shtml'}\n",
      "招聘职位 Python工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927302547.shtml'}\n",
      "招聘职位 python开发工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927300627.shtml'}\n",
      "招聘职位 python开发工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927300625.shtml'}\n",
      "招聘职位 Python软件开发工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927232433.shtml'}\n",
      "招聘职位 python开发工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927180215.shtml'}\n",
      "招聘职位 python课程研究员\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927178053.shtml'}\n",
      "招聘职位 python开发工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927154447.shtml'}\n",
      "招聘职位 Python工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927121833.shtml'}\n",
      "招聘职位 python web讲师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927116267.shtml'}\n",
      "招聘职位 python开发工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927082609.shtml'}\n",
      "招聘职位 Python全栈工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927062427.shtml'}\n",
      "招聘职位 高级Python开发工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927043539.shtml'}\n",
      "招聘职位 高级python\n",
      "职位招聘链接 {'https://www.liepin.com/job/1927006645.shtml'}\n",
      "招聘职位 Python软件开发工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1926992417.shtml'}\n",
      "招聘职位 Python软件开发工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1926992405.shtml'}\n",
      "招聘职位 大数据开发工程师 (Spark/Python)\n",
      "职位招聘链接 {'https://www.liepin.com/job/1926984287.shtml'}\n",
      "招聘职位 Python开发工程师\n",
      "职位招聘链接 {'https://www.liepin.com/job/1926983999.shtml'}\n",
      "招聘职位 代码开发工程师（Fortran/Matlab/Python/C/C++中任意1-3门语言）\n",
      "职位招聘链接 {'https://www.liepin.com/job/1926933817.shtml'}\n",
      "招聘职位 Python\n",
      "职位招聘链接 {'https://www.liepin.com/job/1926901195.shtml'}\n",
      "招聘职位 后端开发工程师（Python）\n",
      "职位招聘链接 {'https://www.liepin.com/job/1926882501.shtml'}\n"
     ]
    }
   ],
   "source": [
    "from requests_html import HTMLSession # 导入模块\n",
    "\n",
    "session = HTMLSession()# 使用session\n",
    "\n",
    "r = session.get('https://www.liepin.com/zhaopin/?key=python') # 添加关键词\n",
    "\n",
    "# 通过xpath找到工作标签\n",
    "news = r.html.xpath('//div[@class=\"job-info\"]/h3/a') # // 以下所有层-不分层 [@属性]条件\n",
    "#             以下所有^^   [@attribute]條件  \n",
    "\n",
    "for new in news:\n",
    "    print(\"招聘职位\",new.text)  # 获得工作标题\n",
    "    print(\"职位招聘链接\",new.absolute_links)  # 获得工作链接"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "招聘职位 UX视觉设计leader\n",
      "面议 广州 大专及以上 5年以上\n",
      "2小时前 投递后：5个工作日内反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1926847327.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 用户体验师（UE/UX）\n",
      "15-20k·13薪 广州-天河区 大专及以上 2年以上\n",
      "4小时前 投递后：7个工作日内反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1926491761.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 UE 设计\n",
      "25-35k·12薪 广州 大专及以上 1年以上\n",
      "9小时前 投递后：72小时反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1918427319.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 UE交互设计师\n",
      "15-25k·13薪 广州 统招本科 3年以上\n",
      "9小时前 投递后：72小时反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1914332647.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 UED设计总监\n",
      "30-40k·13薪 广州-海珠区 本科及以上 5年以上\n",
      "6分钟前 投递后：72小时反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1927333401.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 用户体验主管\n",
      "8-12k·14薪 广州-大石 本科及以上 5年以上\n",
      "1小时前 投递后：24小时反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1927329045.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 交互设计师\n",
      "18-28k·16薪 广州 本科及以上 经验不限\n",
      "5小时前 投递后：72小时反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1927317609.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 UE交互设计\n",
      "20-35k·15薪 北京,广州,杭州 学历不限 3年以上\n",
      "5小时前\n",
      "招聘链接 {'https://www.liepin.com/a/18492143.shtml'}\n",
      "招聘职位 游戏UE\n",
      "35-65k·16薪 北京,广州,上海 统招本科 3年以上\n",
      "9小时前\n",
      "招聘链接 {'https://www.liepin.com/a/19332139.shtml'}\n",
      "招聘职位 交互设计师\n",
      "10-15k·12薪 广州 本科及以上 1年以上\n",
      "7小时前 投递后：5个工作日内反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1926650847.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 用户体验主管\n",
      "8-12k·14薪 广州-番禺区 本科及以上 5年以上\n",
      "4小时前 投递后：24小时反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1926591489.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 交互设计师\n",
      "12-17k·14薪 广州 本科及以上 3年以上\n",
      "51分钟前 投递后：24小时反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1926390861.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 体验设计师\n",
      "10-15k·12薪 广州-天河区 统招本科 3年以上\n",
      "2小时前 投递后：72小时反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1926328443.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 交互设计师\n",
      "10-20k·14薪 广州-越秀区 统招本科 3年以上\n",
      "9小时前 投递后：7个工作日内反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1924769527.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 ue4程序\n",
      "10-15k·12薪 广州-天河区 大专及以上 1年以上\n",
      "4小时前 投递后：72小时反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1924720563.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 交互设计师\n",
      "20-40k·16薪 上海,广州,杭州 本科及以上 1年以上\n",
      "7小时前\n",
      "招聘链接 {'https://www.liepin.com/a/19699059.shtml', 'https://www.liepin.com/sh/zhaopin/'}\n",
      "招聘职位 交互设计师\n",
      "15-25k·13薪 广州,杭州 统招本科 2年以上\n",
      "4小时前\n",
      "招聘链接 {'https://www.liepin.com/a/19572339.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 交互设计师\n",
      "10-15k·12薪 广州-番禺区 大专及以上 2年以上\n",
      "9小时前\n",
      "招聘链接 {'https://www.liepin.com/gz/zhaopin/', 'https://www.liepin.com/a/19334411.shtml'}\n",
      "招聘职位 交互设计师\n",
      "20-40k·16薪 广州,深圳 统招本科 1年以上\n",
      "5小时前\n",
      "招聘链接 {'https://www.liepin.com/a/19323387.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 交互设计师\n",
      "25-40k·14薪 浙江,上海,广州 统招本科 3年以上\n",
      "9小时前\n",
      "招聘链接 {'https://www.liepin.com/a/19303529.shtml'}\n",
      "招聘职位 交互设计师\n",
      "15-30k·13薪 广州,杭州,上海 统招本科 1年以上\n",
      "4小时前\n",
      "招聘链接 {'https://www.liepin.com/a/19240607.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 UE4特效师\n",
      "8-12k·13薪 广州-五山 大专及以上 3年以上\n",
      "7小时前 投递后：72小时反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1926903075.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 游戏交互设计师\n",
      "20-30k·13薪 广州-天河区 本科及以上 3年以上\n",
      "4小时前 投递后：7个工作日内反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1926853803.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 UE开发工程师\n",
      "8-13k·13薪 广州 本科及以上 2年以上\n",
      "7小时前 投递后：24小时反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1926480939.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 UE4设计师\n",
      "10-15k·12薪 广州 学历不限 经验不限\n",
      "2小时前 投递后：5个工作日内反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1926298071.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 UE4设计师\n",
      "10-20k·13薪 广州-珠江新城 大专及以上 1年以上\n",
      "4小时前 投递后：72小时反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1924717655.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 UE4技术美术\n",
      "10-18k·12薪 广州-天河区 大专及以上 2年以上\n",
      "9小时前 投递后：5个工作日内反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1922043495.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 高级UE4特效\n",
      "20-30k·14薪 广州-天河区 本科及以上 2年以上\n",
      "6小时前\n",
      "招聘链接 {'https://www.liepin.com/gz/zhaopin/', 'https://www.liepin.com/a/19672201.shtml'}\n",
      "招聘职位 高级UE设计师\n",
      "25-50k·15薪 广州-天河区 统招本科 3年以上\n",
      "9小时前\n",
      "招聘链接 {'https://www.liepin.com/a/19654945.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 交互设计工程师（UE）\n",
      "8-15k·12薪 广州-花都区 本科及以上 2年以上\n",
      "10小时前 投递后：5个工作日内反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1919654451.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 VR体验馆设计\n",
      "25-30k·17薪 北京,上海,广州 统招本科 5年以上\n",
      "4小时前\n",
      "招聘链接 {'https://www.liepin.com/a/19488567.shtml'}\n",
      "招聘职位 高级交互设计师\n",
      "25-38k·13薪 广州,上海,深圳 大专及以上 3年以上\n",
      "9小时前\n",
      "招聘链接 {'https://www.liepin.com/a/19353397.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 资深交互设计师\n",
      "25-35k·12薪 广州 统招本科 3年以上\n",
      "9小时前\n",
      "招聘链接 {'https://www.liepin.com/a/18615141.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 UE4引擎专家\n",
      "30-50k·13薪 广州-天河区 大专及以上 5年以上\n",
      "1小时前\n",
      "招聘链接 {'https://www.liepin.com/a/18613367.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 UE4实习生\n",
      "3-6k·12薪 广州-海珠区 大专及以上 经验不限\n",
      "10小时前 投递后：72小时反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1918137213.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 UE4视频特效\n",
      "12-20k·12薪 广州-东圃 大专及以上 2年以上\n",
      "2小时前 投递后：72小时反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1917253593.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 UI/UE设计师\n",
      "6-8k·12薪 广州 统招本科 1年以上\n",
      "7小时前 投递后：10个工作日内反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1927314753.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 UE4视频设计师\n",
      "7-15k·12薪 广州-瑞宝 学历不限 3年以上\n",
      "9小时前 投递后：7个工作日内反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1926382789.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 用户体验经理（电商）\n",
      "10-15k·12薪 广州-大沙 大专及以上 5年以上\n",
      "9小时前 投递后：72小时反馈\n",
      "招聘链接 {'https://www.liepin.com/job/1926153085.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n",
      "招聘职位 资深/专家交互设计师\n",
      "20-40k·16薪 广州,杭州 学历不限 3年以上\n",
      "9小时前\n",
      "招聘链接 {'https://www.liepin.com/a/19186391.shtml', 'https://www.liepin.com/gz/zhaopin/'}\n"
     ]
    }
   ],
   "source": [
    "from requests_html import HTMLSession\n",
    "# 使用session\n",
    "session = HTMLSession()\n",
    "r = session.get('https://www.liepin.com/zhaopin/?key=UX+广州') # 限定词UX+广州\n",
    "\n",
    "# 使用xpath找到工作标题\n",
    "news = r.html.xpath('//div[@class=\"job-info\"]') \n",
    "\n",
    "for new in news:\n",
    "    print(\"招聘职位\",new.text)  #获得工作标题\n",
    "    print(\"招聘链接\",new.absolute_links) #获得工作网址"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "职位 主播经纪人\n",
      "7-15k·12薪 广州 学历不限 经验不限\n",
      "1小时前 投递后：7个工作日内反馈\n",
      "职位 保险代理人/经纪人/客户经理\n",
      "10-15k·12薪 广州 大专及以上 经验不限\n",
      "1小时前 投递后：24小时反馈\n",
      "职位 快手主播经纪人\n",
      "7-15k·12薪 广州 学历不限 经验不限\n",
      "1小时前 投递后：7个工作日内反馈\n",
      "职位 达人经纪人\n",
      "5-8k·12薪 广州 学历不限 经验不限\n",
      "3小时前 投递后：24小时反馈\n",
      "职位 保险客户经理—经纪人\n",
      "20-35k·12薪 广州-南沙区 本科及以上 3年以上\n",
      "5小时前 投递后：7个工作日内反馈\n",
      "职位 保险代理人/经纪人/客户经理\n",
      "5-9k·12薪 广州 中专/中技及以上 经验不限\n",
      "11小时前 投递后：24小时反馈\n",
      "职位 高薪诚聘平安保险经纪人\n",
      "10-12k·12薪 广州 大专及以上 1年以上\n",
      "29分钟前 投递后：24小时反馈\n",
      "职位 综合金融经纪人\n",
      "11-22k·12薪 广州 本科及以上 3年以上\n",
      "10小时前 投递后：24小时反馈\n",
      "职位 保险代理人/经纪人/客户经理\n",
      "14-18k·12薪 广州-天河区 大专及以上 3年以上\n",
      "9小时前 投递后：24小时反馈\n",
      "职位 保险代理人/经纪人/客户经理\n",
      "9-14k·12薪 广州 本科及以上 经验不限\n",
      "3小时前 投递后：24小时反馈\n",
      "职位 保险代理人/经纪人/客户经理\n",
      "10-15k·12薪 广州-天河区 中专/中技及以上 1年以上\n",
      "1小时前 投递后：24小时反馈\n",
      "职位 保险代理人/经纪人/客户经理\n",
      "6-8k·12薪 广州 中专/中技及以上 经验不限\n",
      "10小时前 投递后：24小时反馈\n",
      "职位 网红经纪人\n",
      "10-15k·14薪 广州 中专/中技及以上 2年以上\n",
      "11小时前\n",
      "职位 保险 经纪人\n",
      "6-9k·12薪 广州 大专及以上 1年以上\n",
      "22小时前 投递后：24小时反馈\n",
      "职位 保险代理人/经纪人/客户经理\n",
      "20-40k·12薪 广州 大专及以上 经验不限\n",
      "昨天 投递后：24小时反馈\n",
      "职位 保险代理经纪人\n",
      "10-20k·12薪 广州-天河区 大专及以上 3年以上\n",
      "昨天 投递后：24小时反馈\n",
      "职位 证券经纪人\n",
      "4-9k·12薪 广州-天河北 本科及以上 3年以上\n",
      "昨天 投递后：24小时反馈\n",
      "职位 中国平安保险经纪人\n",
      "10-20k·12薪 广州-天河区 大专及以上 3年以上\n",
      "昨天 投递后：5个工作日内反馈\n",
      "职位 保险代理人/经纪人/客户经理\n",
      "10-15k·12薪 广州-海珠区 大专及以上 经验不限\n",
      "前天 投递后：24小时反馈\n",
      "职位 保险代理人/经纪人/客户经理\n",
      "10-15k·12薪 广州-越秀区 大专及以上 1年以上\n",
      "前天 投递后：24小时反馈\n",
      "职位 保险代理人/经纪人/客户经理\n",
      "15-20k·12薪 广州 大专及以上 5年以上\n",
      "前天 投递后：24小时反馈\n",
      "职位 保险代理人/经纪人/客户经理\n",
      "10-15k·12薪 广州-海珠区 大专及以上 经验不限\n",
      "前天 投递后：24小时反馈\n",
      "职位 底薪3000+高提成销售商业地产经纪人销售专员\n",
      "10-15k·12薪 广州 学历不限 1年以上\n",
      "2020-04-06 投递后：24小时反馈\n",
      "职位 底薪3000加高提成招聘商业地产经纪人销售专员\n",
      "15-30k·12薪 广州 学历不限 1年以上\n",
      "2020-04-06 投递后：24小时反馈\n",
      "职位 直播经纪人\n",
      "5-10k·12薪 广州-番禺区 大专及以上 1年以上\n",
      "2020-04-06 投递后：24小时反馈\n",
      "职位 房地产销售经纪人\n",
      "2-4k·12薪 广州 大专及以上 经验不限\n",
      "2020-04-06 投递后：72小时反馈\n",
      "职位 保险 经纪人\n",
      "6-12k·12薪 广州-黄埔区 大专及以上 1年以上\n",
      "前天 投递后：24小时反馈\n",
      "职位 保险代理人/经纪人/客户经理\n",
      "9-13k·13薪 广州 大专及以上 经验不限\n",
      "前天 投递后：24小时反馈\n",
      "职位 经纪人\n",
      "4-8k·12薪 广州 本科及以上 经验不限\n",
      "2020-04-06 投递后：5个工作日内反馈\n",
      "职位 主播经纪人\n",
      "3-6k·12薪 广州 学历不限 经验不限\n",
      "2020-04-04 投递后：24小时反馈\n",
      "职位 证券经纪人\n",
      "8-12k·12薪 广州-天河区 中专/中技及以上 经验不限\n",
      "2020-04-03 投递后：24小时反馈\n",
      "职位 达人经纪人\n",
      "5-8k·12薪 广州-越秀区 大专及以上 经验不限\n",
      "2020-04-03 投递后：24小时反馈\n",
      "职位 房地产经纪人\n",
      "10-15k·12薪 广州-白云区 中专/中技及以上 经验不限\n",
      "2020-04-03 投递后：24小时反馈\n",
      "职位 高薪诚聘平安保险经纪人\n",
      "7-12k·12薪 广州 大专及以上 1年以上\n",
      "2020-04-03 投递后：24小时反馈\n",
      "职位 保险 经纪人\n",
      "9-12k·12薪 广州 大专及以上 1年以上\n",
      "2020-04-03 投递后：24小时反馈\n",
      "职位 保险代理人/经纪人/客户经理\n",
      "8-12k·12薪 广州-黄埔区 大专及以上 1年以上\n",
      "2020-04-03 投递后：24小时反馈\n",
      "职位 保险代理人/经纪人/客户经理\n",
      "15-30k·12薪 广州 大专及以上 经验不限\n",
      "2020-04-03 投递后：24小时反馈\n",
      "职位 证券经纪人\n",
      "面议 广州-珠江新城 学历不限 经验不限\n",
      "2020-04-02 投递后：7个工作日内反馈\n",
      "职位 保险代理人/经纪人/客户经理\n",
      "20-25k·12薪 广州 大专及以上 5年以上\n",
      "2020-04-01 投递后：24小时反馈\n",
      "职位 证券经纪人\n",
      "2-6k·12薪 广州 大专及以上 经验不限\n",
      "2020-03-31 投递后：24小时反馈\n",
      "薪水 7-15k·12薪\n",
      "薪水 10-15k·12薪\n",
      "薪水 7-15k·12薪\n",
      "薪水 5-8k·12薪\n",
      "薪水 20-35k·12薪\n",
      "薪水 5-9k·12薪\n",
      "薪水 10-12k·12薪\n",
      "薪水 11-22k·12薪\n",
      "薪水 14-18k·12薪\n",
      "薪水 9-14k·12薪\n",
      "薪水 10-15k·12薪\n",
      "薪水 6-8k·12薪\n",
      "薪水 10-15k·14薪\n",
      "薪水 6-9k·12薪\n",
      "薪水 20-40k·12薪\n",
      "薪水 10-20k·12薪\n",
      "薪水 4-9k·12薪\n",
      "薪水 10-20k·12薪\n",
      "薪水 10-15k·12薪\n",
      "薪水 10-15k·12薪\n",
      "薪水 15-20k·12薪\n",
      "薪水 10-15k·12薪\n",
      "薪水 10-15k·12薪\n",
      "薪水 15-30k·12薪\n",
      "薪水 5-10k·12薪\n",
      "薪水 2-4k·12薪\n",
      "薪水 6-12k·12薪\n",
      "薪水 9-13k·13薪\n",
      "薪水 4-8k·12薪\n",
      "薪水 3-6k·12薪\n",
      "薪水 8-12k·12薪\n",
      "薪水 5-8k·12薪\n",
      "薪水 10-15k·12薪\n",
      "薪水 7-12k·12薪\n",
      "薪水 9-12k·12薪\n",
      "薪水 8-12k·12薪\n",
      "薪水 15-30k·12薪\n",
      "薪水 面议\n",
      "薪水 20-25k·12薪\n",
      "薪水 2-6k·12薪\n"
     ]
    }
   ],
   "source": [
    "from requests_html import HTMLSession\n",
    "# 使用session\n",
    "session = HTMLSession()\n",
    "r = session.get('https://www.liepin.com/zhaopin/?key=经纪人+广州') # 限定词经纪人+广州\n",
    "\n",
    "# 使用xpath找到工作标题\n",
    "news1 = r.html.xpath('//div[@class=\"job-info\"]')\n",
    "news2 = r.html.xpath('//span[@class=\"text-warning\"]') #薪水\n",
    "\n",
    "for new in news1:\n",
    "    print(\"职位\",new.text)  #获得职位标题\n",
    "for new2 in news2:\n",
    "    print(\"薪水\",new2.text)  #薪水"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "新华社日内瓦4月5日电（记者沈忠浩）世界卫生组织5日晚发布的每日疫情报告指出，目前中国从新冠疫情遏制阶段进入缓解阶段，中国在防控疫情中积累了重要经验。\n",
      "报告援引世卫组织驻华代表高登·加莱亚的话说，中国在防控疫情方面积累了非常重要的经验，特别是因地制宜，采取了适合各地不同情况的公共卫生措施，非常有效地控制了疫情传播。\n",
      "加莱亚指出，通过保持社交距离、隔离、加强个人卫生等举措，中国人民为遏制疫情传播做出巨大努力，产生积极成效。\n",
      "加莱亚表示，各国应共同协作分享抗疫经验和疫情信息，互相借鉴学习，采取及时有效的防控措施。\n",
      "世卫组织的数据显示，截至欧洲中部时间5日18时（北京时间6日零时），全球累计确诊病例达1136851例，累计病亡62955例。\n"
     ]
    }
   ],
   "source": [
    "from requests_html import HTMLSession\n",
    "# 使用session\n",
    "session = HTMLSession()\n",
    "r = session.get(\"http://world.people.com.cn/n1/2020/0406/c1002-31662927.html\") #人民网-国际-滚动新闻《世卫组织：中国在防控疫情中积累重要经验》\n",
    "\n",
    "news = r.html.xpath('//*[@id=\"rwb_zw\"]/p') # 文章\n",
    "\n",
    "for new in news:\n",
    "    print(new.text)  #获得文章内容"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "####  展示图\n",
    "* Jupyter 可用的魔法之一 IPython 展示模块, HTML转码"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<img src=\"https://httpstatusdogs.com/img/418.jpg\" alt=\"\">"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from IPython.core.display import display, HTML\n",
    "display(HTML('<img src=\"https://httpstatusdogs.com/img/418.jpg\" alt=\"\">'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<img src=\"https://www.linefriends.cn/Storage/master/gallery/201912/201912311645014921990.jpg\" alt=\"\">"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from IPython.core.display import display, HTML\n",
    "display(HTML('<img src=\"https://www.linefriends.cn/Storage/master/gallery/201912/201912311645014921990.jpg\" alt=\"\">'))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "####  展示图\n",
    "* Jupyter 可用的魔法之一 IPython 展示模块, HTML转码"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "![](https://httpstatusdogs.com/img/418.jpg)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from IPython.core.display import display, Markdown\n",
    "display(Markdown('![](https://httpstatusdogs.com/img/418.jpg)'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "![](https://www.linefriends.cn/Storage/master/gallery/201912/201912311645014921990.jpg)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from IPython.core.display import display, Markdown\n",
    "display(Markdown('![](https://www.linefriends.cn/Storage/master/gallery/201912/201912311645014921990.jpg)'))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "### 抓抓图片?\n",
    "[图片新闻_Bing](http://www.gov.cn/xinwen/tupian/index.htm)\n",
    "\n",
    "####  项目0.C 图片新闻"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/templates/master/default/images/jiantou_03.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/templates/master/default/images/jiantou_03.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/templates/master/default/images/jiantou_03.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/templates/master/default/images/jiantou_03.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/QRCode/www.linefriends.cn_vshop.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/QRCode/www.linefriends.cn_vshop.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/templates/master/default/images/jiantou_03.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/templates/master/default/images/jiantou_03.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/QRCode/www.linefriends.cn_appdownload.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/QRCode/www.linefriends.cn_appdownload.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/utility/pics/201907291644503592140.jpg\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/utility/pics/201907291644503592140.jpg)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/templates/master/default/images/down.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/templates/master/default/images/down.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201907251647363443210.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201907251647363443210.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201809201512537202830.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201809201512537202830.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201809201513426284110.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201809201513426284110.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201809201513550527160.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201809201513550527160.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201809201514043860820.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201809201514043860820.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201809201514208915990.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201809201514208915990.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201809201514301439070.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201809201514301439070.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201809201514398073640.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201809201514398073640.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201809201514516984460.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201809201514516984460.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201809201515024781570.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201809201515024781570.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201809201515125888970.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201809201515125888970.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201809201515256401790.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201809201515256401790.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201809201725480841040.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201809201725480841040.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201809201518064432290.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201809201518064432290.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201809201518310974960.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201809201518310974960.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201809201518560134910.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201809201518560134910.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201809201519210212880.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201809201519210212880.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201809201519454782810.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201809201519454782810.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201809201520100973910.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201809201520100973910.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201809201520364167610.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201809201520364167610.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201809201521005114360.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201809201521005114360.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201812100015354156640.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201812100015354156640.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201812100015144138810.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201812100015144138810.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201812100014481335750.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201812100014481335750.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201812100014214684890.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201812100014214684890.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201812100013356239550.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201812100013356239550.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201812100012342563640.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201812100012342563640.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/category/201812100011148431590.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/category/201812100011148431590.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/templates/pccommon/images/new/icon_03.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/templates/pccommon/images/new/icon_03.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/templates/pccommon/images/new/icon_06.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/templates/pccommon/images/new/icon_06.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/templates/pccommon/images/new/icon_08.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/templates/pccommon/images/new/icon_08.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/templates/pccommon/images/new/Layer.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/templates/pccommon/images/new/Layer.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/QRCode/www.linefriends.cn_appdownload.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/QRCode/www.linefriends.cn_appdownload.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/templates/pccommon/images/new/jiantou.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/templates/pccommon/images/new/jiantou.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/templates/pccommon/images/new/youhuiquan.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/templates/pccommon/images/new/youhuiquan.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/utility/pics/202003201759304741150.jpg\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/utility/pics/202003201759304741150.jpg)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/utility/pics/202003091354280522300.jpg\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/utility/pics/202003091354280522300.jpg)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/utility/pics/202003091354046928510.jpg\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/utility/pics/202003091354046928510.jpg)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/utility/pics/202003051134074273080.jpg\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/utility/pics/202003051134074273080.jpg)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/utility/pics/202002260917518521750.jpg\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/utility/pics/202002260917518521750.jpg)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/article/202003231111170678520.jpg\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/article/202003231111170678520.jpg)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/article/202003091349447241030.jpg\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/article/202003091349447241030.jpg)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/article/202003091347475522350.jpg\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/article/202003091347475522350.jpg)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/article/202003031126059302620.jpg\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/article/202003031126059302620.jpg)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/article/202002281134270865140.jpg\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/article/202002281134270865140.jpg)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/article/202002260918375396690.jpg\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/article/202002260918375396690.jpg)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/article/202001131514595861680.gif\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/article/202001131514595861680.gif)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/article/202001091314296023350.jpg\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/article/202001091314296023350.jpg)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/article/201912091502588516550.gif\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/article/201912091502588516550.gif)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "https://www.linefriends.cn/Storage/master/gallery/202002/202002271306184302210.jpg\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](https://www.linefriends.cn/Storage/master/gallery/202002/202002271306184302210.jpg)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "https://www.linefriends.cn/Storage/master/gallery/201909/201909070201510821580.jpg\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](https://www.linefriends.cn/Storage/master/gallery/201909/201909070201510821580.jpg)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "https://www.linefriends.cn/Storage/master/gallery/20200110/6371424418643179393671282.jpg\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](https://www.linefriends.cn/Storage/master/gallery/20200110/6371424418643179393671282.jpg)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "https://www.linefriends.cn/Storage/master/gallery/201912/201912311645014921990.jpg\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](https://www.linefriends.cn/Storage/master/gallery/201912/201912311645014921990.jpg)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "https://www.linefriends.cn/Storage/master/gallery/201909/201909070000482384343.jpg\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](https://www.linefriends.cn/Storage/master/gallery/201909/201909070000482384343.jpg)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "https://www.linefriends.cn/Storage/master/gallery/201912/201912311645014921991.jpg\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](https://www.linefriends.cn/Storage/master/gallery/201912/201912311645014921991.jpg)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Storage/master/gallery/20180323/6365736911109689444578753.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/Storage/master/gallery/20180323/6365736911109689444578753.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/templates/master/default/UploadImage/advertimg/20180323021551_3135.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](/templates/master/default/UploadImage/advertimg/20180323021551_3135.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "https://www.linefriends.cn/Storage/master/link/201804271720173444970.png\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "![](https://www.linefriends.cn/Storage/master/link/201804271720173444970.png)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from requests_html import HTMLSession\n",
    "\n",
    "session = HTMLSession()\n",
    "\n",
    "r = session.get(\"https://www.linefriends.cn/\")\n",
    "\n",
    "# 通过xpath找到图片标签\n",
    "items = r.html.xpath('//img/@src')\n",
    "\n",
    "for url in items:\n",
    "    print(url)  # 获得图片src url\n",
    "    display(Markdown('![]({url})'.format(url=url)))  # 展示图片    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "![](<Element 'img' src='/Storage/master/article/202003231111170678520.jpg'>)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from requests_html import HTMLSession\n",
    "\n",
    "session = HTMLSession()\n",
    "\n",
    "r = session.get(\"https://www.linefriends.cn/\")\n",
    "\n",
    "# 通过xpath找到工作标签\n",
    "items = r.html.xpath('//*[@id=\"main\"]/div[2]/div[1]/ul/li[1]/div[1]/a/img') #linefriends官网上的新品商品图，其中一张\n",
    "\n",
    "for url in items:\n",
    "  # 获得图片src url\n",
    "    display(Markdown('![]({url})'.format(url=url)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "![](<Element 'img' src='/Storage/master/article/202003231111170678520.jpg'>)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/markdown": [
       "![](<Element 'img' src='/Storage/master/article/202003091349447241030.jpg'>)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/markdown": [
       "![](<Element 'img' src='/Storage/master/article/202003091347475522350.jpg'>)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/markdown": [
       "![](<Element 'img' src='/Storage/master/article/202003031126059302620.jpg'>)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/markdown": [
       "![](<Element 'img' src='/Storage/master/article/202002281134270865140.jpg'>)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/markdown": [
       "![](<Element 'img' src='/Storage/master/article/202002260918375396690.jpg'>)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/markdown": [
       "![](<Element 'img' src='/Storage/master/article/202001131514595861680.gif'>)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/markdown": [
       "![](<Element 'img' src='/Storage/master/article/202001091314296023350.jpg'>)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/markdown": [
       "![](<Element 'img' src='/Storage/master/article/201912091502588516550.gif'>)"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from requests_html import HTMLSession\n",
    "\n",
    "session = HTMLSession()\n",
    "\n",
    "r = session.get(\"https://www.linefriends.cn/\")\n",
    "\n",
    "# 通过xpath找到工作标签\n",
    "items = r.html.xpath('//*[@id=\"main\"]/div[2]/div/ul/li/div/a/img') #linefriends官网上的新品商品图\n",
    "\n",
    "for url in items:\n",
    "  # 获得图片src url\n",
    "    display(Markdown('![]({url})'.format(url=url)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
